﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace Common
{
    [Table]
    public class DonViTinh
    {
        [Column(IsPrimaryKey=true, IsDbGenerated=true, DbType="Int NOT NULL IDENTITY", AutoSync= AutoSync.OnInsert)]
        public int iDonViTinh_ID { get; set; }
        [Column]
        public string sTenDonViTinh { get; set; }
        public DonViTinh()
        {

        }
        public DonViTinh(SqlDataReader reader)
        {
            if (reader != null && !reader.IsClosed && reader.Read())
            {
                //if(!reader.IsDBNull(reader.GetOrdinal("iDonViTinh_ID"));
                if (DAHelper.HasColumn(reader, "iDonViTinh_ID")) this.iDonViTinh_ID = Convert.ToInt32(reader["iDonViTinh_ID"]);
                if (DAHelper.HasColumn(reader, "sTenDonViTinh")) this.sTenDonViTinh = reader["sTenDonViTinh"].ToString();

            }
            reader.Close();
            reader.Dispose();
        }
    }
}
